<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>背景图片</title>
    <style>
        #box{
            width: 300px;
            height: 300px;
            border: 1px dashed red;
            background-image: url("../images/cxk3.webp");
            background-repeat: no-repeat;/*不重叠*/
            background-size: 100%;
            background-position: left;/*水平方向*/
            /*background-attachment: fixed;!*设置背景图片在背景视口位置固定*!*/
            opacity: 50%;/*透明度*/
        }
        #box2{
            width: 100px;
            height: 100px;
            border: 1px solid red;
            color: blue;
        }
    </style>
</head>
<body>
<div id="box">蔡徐坤</div>
<hr>
<div id="box2">
    盒子2
    盒子2
    盒子2
    盒子2
    盒子2
    盒子2
</div>
</body>
</html>
